package zsl.generator;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Random;

import zsl.utils.WordCountList;

public abstract class WordListGenerator {
	String[] dict;
	int dictLen;
	Random randomLineGen;
	final String DICT_PATH = "./src/words.txt";
	
	public WordListGenerator(int dictLen, long seed) throws IOException {
		this.dictLen = dictLen;
		dict =  new String[dictLen];
		this.randomLineGen = new Random(seed);
		generateDict();
	}
	
	public abstract WordCountList generateWords(int numOfWord);
	
	private void generateDict() throws IOException{
		BufferedReader reader = new BufferedReader(new FileReader(DICT_PATH));
		for (int i = 0; i < dict.length; i++) {
			dict[i] = reader.readLine();
		}
	}
}
